package com.example.panda.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SearchView;
import android.widget.Toast;

import com.example.panda.R;


public class SquareFragment extends Fragment {
    //搜索框
//    private SearchView squareSearchView;
//    private ListView squareListView;
//    private String[] mStrings = { "aaaaa", "bbbbbb", "cccccc", "ddddddd" };

    public SquareFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        final View view = inflater.inflate(R.layout.fragment_square, container, false);
        //List
//        squareListView = (ListView) view.findViewById(R.id.lv);
//        squareListView.setAdapter(new ArrayAdapter<String>(view.getContext(),android.R.layout.simple_list_item_1, mStrings));
//        squareListView.setTextFilterEnabled(true);//设置lv可以被过虑
//        //Search
//        squareSearchView = (SearchView)view.findViewById(R.id.searchView);
//        squareSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
//            @Override
//            public boolean onQueryTextSubmit(String query) {
//                Toast.makeText(view.getContext(), "您的选择是:" + query, Toast.LENGTH_SHORT).show();
//                return false;
//            }
//
//            @Override
//            public boolean onQueryTextChange(String newText) {
//                Toast.makeText(view.getContext(), "textChange--->" + newText, Toast.LENGTH_SHORT).show();
//                if (TextUtils.isEmpty(newText)) {
//                    // 清除ListView的过滤
//                    squareListView.clearTextFilter();
//                } else {
//                    // 使用用户输入的内容对ListView的列表项进行过滤
//                    squareListView.setFilterText(newText);
//                }
//                return true;
//            }
//        });

        return view;
    }

}
